﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using HRProject.Code.DAO;
using HRProject.Code.Common;
using HRProject.Code.DTO;
using System.Collections.Generic;

namespace HRProject.User
{
    public partial class AddRecordType : System.Web.UI.Page
    {
        private Guid recordTypeId = Guid.Empty;

        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void btnOK_Click(object sender, EventArgs e)
        {
            if (!BLAuthentication.IsAddAllowed)
            {
                lblError.Text = ContentProvider.GetMessage("NotAuthorized");
                return;
            }

            RecordTypeDAO dao = new RecordTypeDAO();
            BLRecordType recordType = new BLRecordType();
            recordType.Id = Guid.NewGuid();
            recordType.Name = tbxName.Text.Trim();
            recordType.Description = tbxDescription.Text.Trim();
            int errorCode = 0;
            dao.Insert(recordType, ref errorCode);
            Util.CloseFrame(Response);
        }
    }
}
